﻿<%template _header%>
<%if {infloat}!=1%>
<script type="text/javascript"  src="{jsdir}/template_calendar.js"></script>
<div id="nav">
	<div class="wrap s_clear">
		<a href="{config.forumurl}" class="title">{config.forumtitle}</a> &raquo; <%if {forum.Pathlist}!=""%>{ShowForumAspxRewrite(forum.Pathlist.Trim(),forumid,forumpageid)} &raquo; <%/if%>
        <strong>编辑帖子</strong>
    </div>
</div>
<%/if%>
<script type="text/javascript">
var postminchars = parseInt({config.minpostsize});
var postmaxchars = parseInt({config.maxpostsize});
var disablepostctrl = parseInt({disablepostctrl});
var tempaccounts = false;
var forumpath = "{forumpath}";
var posturl=forumpath+'editpost.aspx?topicid={topicid}&postid={postid}&forumpage={forumpageid}&pageid={pageid}';
<%if page_err==0%>
var postaction='editpost.aspx?infloat=1&postid={postinfo.pid}&topicid={topic.tid}&';
<%/if%>
function closeedit()
{
		if($('floatwin_edit'))
        $('floatwin_edit').parentNode.removeChild($('floatwin_edit')); 
		if($('floatwin_edit_mask'))
		 $('floatwin_edit_mask').parentNode.removeChild($('floatwin_edit_mask'));
}
</script>

<%if page_err==0%>
<%if {ispost}%>
	<%if {infloat}==1%>
		<script type="text/javascript">
		$('returnmessage').className='';
		location.href='{rooturl}{msgbox_url}';		
		</script>
	<%else%>
	<%template _msgbox%>
	<%/if%>
<%else%>
	<%if {infloat}==0%>
<div class="wrap s_clear" id="wrap">
	<div class="main">
	<div class="nojs" style="position:relative;">
	<div id="floatwinnojs">
	<%/if%>
	<div id="floatlayout_edit" class="float" <%if {infloat}==1%>style="width: 600px; height: 410px;"<%/if%>>
		<script>
	function geteditormessage(theform)
	{
    	var message = wysiwyg ? html2bbcode(getEditorContents()) : (!theform.parseurloff.checked ? parseurl(theform.message.value) : theform.message.value);
	    theform.message.value = message;
	}
	</script>
	<%if {infloat}==1%>
    <form method="post" name="postform" id="postform" action="editpost.aspx?infloat=1&postid={postinfo.pid}&topicid={topic.tid}&" enctype="multipart/form-data" onsubmit="return validate(this);">
    <%else%>
    <form method="post" name="postform" id="postform" action="" enctype="multipart/form-data" onsubmit="return validate(this);">
	<%/if%>
	<%template _post%>
    <script  type="text/javascript" reload="1">
	openEditor();
	</script>
	<div style="display: none;" id="specialposttable">
	<%if {postinfo.layer}==0%>
	<%if {topic.special}==1%>
	<div class="specialpost s_clear">
		<p><em>选项:</em>每行填写 1 个选项</p>
		<div class="specialinfo sppoll"  id="divPoll">
			<input id="PollItemname" type="hidden" name="PollItemname" value="" />
			<input id="PollOptionDisplayOrder" type="hidden" name="PollOptionDisplayOrder" value="" />
			<input id="PollOptionID" type="hidden" name="PollOptionID" value="" />
			<div id="polloptions">
			<%loop poll polloptionlist%>
				<p <%if {poll[_id]}==1%>id="divPollItem" <%/if%> name="PollItem">
					<input type="hidden" name="optionid" value="{poll[polloptionid]}">
					<input type="text" class="txt left" style="margin-right:2px" size="2" name="displayorder" maxlength="4" value="{poll[displayorder]}" />
					<input type="text" name="pollitemid" value="{poll[name]}" class="optioninfo txt" />
					<a href="javascript:;" class="deloption" title="删除投票项" onclick="if(!delObj(document.getElementById('polloptions'),2)){alert('投票项不能少于2个');}">del</a>
				</p>
			<%/loop%>
			</div>
			<p><a onclick="clonePoll('{config.maxpolloptions}')" href="javascript:;">+增加投票项</a> 
			<a onclick="if(!delObj(document.getElementById('polloptions'), (is_ie ? 2 : 4))){alert('投票项不能少于2个');}" href="javascript:;">删除投票项</a>
			</p>
		</div>
		<div class="specialaddons">
			<p><label for="polldatas">投票结束日期</label>
				<input name="enddatetime" type="text" id="enddatetime" size="10" value="{pollinfo.expiration}" style="cursor: default" onclick="showcalendar(event, 'enddatetime', 'cal_startdate', 'cal_enddate', '{nowdate}');" readonly="readonly" />
				<input type="hidden" name="cal_startdate" id="cal_startdate" size="10" value="{nowdate}">
				<input type="hidden" name="cal_enddate" id="cal_enddate" size="10" value="">
			</p>
			<p><label for="pollnum">
				<input <%if {pollinfo.multiple}==1%>checked="checked" <%/if%> type="checkbox" name="multiple"
				onclick="this.checked?$('maxchoicescontrol').style.display='':$('maxchoicescontrol').style.display='none';" />多选投票
				</label>
				<span id="maxchoicescontrol" <%if {pollinfo.multiple}==0%>style="display: none;"<%/if%>>最多可选项数: <input type="text" tabindex="1" value="{pollinfo.maxchoices}" class="spshortinput txt" name="maxchoices"/></span>
			</p>
			<p>
				<input name="updatepoll" type="hidden" id="updatepoll" value="1" />
				<input type="checkbox" name="visiblepoll" <%if {pollinfo.visible}==1%>checked="checked"<%/if%> />提交投票后结果才可见
			</p>
			<p><input type="checkbox" tabindex="1" value="1" name="overt"/>公开投票参与人</p>
		</div>
	</div>
	<%/if%>
	<%if {topic.special}==2%>
	<div class="specialpost s_clear">
		<div class="specialinfo">
			<dl>
				<dt><label for="rewardprice">悬赏价格:</label></dt>
				
				<dd><input name="topicprice" type="text" class="txt" id="topicprice" value="{topic.price}" size="5" maxlength="5" onkeyup="getrealprice(this.value);"/>
		            {userextcreditsinfo.unit} {userextcreditsinfo.name}
				</dd>
				<dd class="tips">
				[ 悬赏范围 {usergroupinfo.minbonusprice} - {usergroupinfo.maxbonusprice}  
				{bonusextcreditsinfo.unit}
				{bonusextcreditsinfo.name}, 当前可用 {mybonustranscredits} {bonusextcreditsinfo.unit}{bonusextcreditsinfo.name}]
				</dd>
				<dd class="tips">
				[ 税后支付 <span id="realprice">0</span>]
				</dd>			
				<script type="text/javascript" reload="1">
				    function getrealprice(price) {
				        if (!price.search(/^\d+$/)) {
				            n = Math.ceil(parseInt(price) + price * {Scoresets.GetCreditsTax()});
				            if (price > 32767) {
				                $('realprice').innerHTML = '<b>悬赏不能高于 32767</b>';
				            } else if (price < {usergroupinfo.minbonusprice} || (price > {usergroupinfo.maxbonusprice})) {
				                $('realprice').innerHTML = '<b>悬赏超出范围</b>';
				            } else {
				                $('realprice').innerHTML = n;
				            }
				        } else {
				            $('realprice').innerHTML = '<b>填写无效</b>';
				        }
				    }
                </script>
			</dl>
		</div>
	</div>
	<%else if {topic.special}==3%>
	<div class="specialpost s_clear">
	<div class="specialinfo">
		<dl>
			<dt><label for="rewardprice">悬赏价格:</label></dt>
			<dd>
			<input name="topicprice" type="hidden" id="topicprice" value="{usergroupinfo.minbonusprice}" />
			{topic.price} {userextcreditsinfo.unit} {userextcreditsinfo.name} (只允许正整数)
			</dd>
			<dd class="tips">
			已经结帖无法修改悬赏金额
			</dd>
		</dl>
	</div>
	</div>
	<%/if%>
	<%/if%>
	</div>
    <input type="hidden" name="aid" id="aid" value="0">
    <input type="hidden" name="isdeleteatt" id="isdeleteatt" value="0">
	<%if {infloat}!=1%>
    <script type="text/javascript">
		isfirstpost  = {postinfo.layer} == 0 ? 1 : 0;
		$('postform').onsubmit = function() { return validate($('postform'));};
		function deleteatt(aid){
			document.getElementById('isdeleteatt').value = 1;
			document.getElementById('aid').value = aid;
			document.getElementById('isdeleteatt').form.submit();
		}
    </script>
	<%/if%>
    <p class="textmsg" id="divshowuploadmsg" style="display: none"></p>
    <p class="textmsg succ" id="divshowuploadmsgok" style="display: none"></p>
    <input type="hidden" name="uploadallowmax" value="10">
    <input type="hidden" name="uploadallowtype" value="jpg,gif">
    <input type="hidden" name="thumbwidth" value="300">
    <input type="hidden" name="thumbheight" value="250">
    <input type="hidden" name="noinsert" value="0">
    </form>
	</div>
	<%if {infloat}==0%>
	</div>
	</div>
	</div>
	</div>
	</div>
	<%/if%>

<%/if%>
<%else%>
	<%if {ispost}%>
		 <%if {infloat}==1%>
         {msgbox_text}
		 <%else%>
		   <%template _errmsgbox%>
		 <%/if%>
	<%else%>
		 <%if {infloat}==1%>
		<div class="floatbox floatbox1">
		<h3 class="float_ctrl">
			<span>
				<a href="javascript:;" class="float_close" onclick="floatwin('floatwin_edit');" title="关闭">关闭</a>
			</span>
		</h3>
		<div class="gateform">
		<h3>{msgbox_text}</h3>
		</div>
		</div>
		 <%else%>
		   <%template _errmsgbox%>
		 <%/if%>
	<%/if%>
<%/if%>
	<script type="text/javascript" reload="1">
	initAttach();
	</script>
<%template _copyright%>
<%template _footer%>